<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class Animal{
            constructor (name){
                this.name=name
            }
            sayName(){
                console.log(`我是${this.name}${this.age}岁`)
            }
        }
        class Dog extends Animal{
            constructor(name,age)
            {
                super(name)
                this.age=age
            }
        }
        let dog =new Dog("旺财",2)
        dog.sayName();
    </script>
</body>
</html>